#include "gtknoselection.h"
#include "gtkfilterlistmodel.h"
#include "gtkboolfilter.h"
+#ifdef G_OS_UNIX
+#include "a11y/gtkatspicontextprivate.h"
+#endif
typedef enum {
STATE,
GtkWidget *box;
GtkWidget *role;
+ GtkWidget *path;
GtkWidget *attributes;
};
g_type_class_unref (eclass);
}
+static void
+update_path (GtkInspectorA11y *sl)
+{
+ const char *path = "—";
+#ifdef G_OS_UNIX
+ GtkATContext *context;
+
+ context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object));
+ if (GTK_IS_AT_SPI_CONTEXT (context))
+ path = gtk_at_spi_context_get_context_path (GTK_AT_SPI_CONTEXT (context));
+#endif
+
+ gtk_label_set_label (GTK_LABEL (sl->path), path);
+}
+
extern GType gtk_string_pair_get_type (void);
static void
gboolean has_value;
context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object));
+ if (!context)
+ return;
store = g_list_store_new (G_TYPE_OBJECT);
refresh_all (GtkInspectorA11y *sl)
{
update_role (sl);
+ update_path (sl);
update_attributes (sl);
}
if (sl->object && GTK_IS_ACCESSIBLE (sl->object))
{
context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object));
- g_signal_handlers_disconnect_by_func (context, refresh_all, sl);
+ if (context)
+ g_signal_handlers_disconnect_by_func (context, refresh_all, sl);
}
g_set_object (&sl->object, object);
if (GTK_IS_ACCESSIBLE (object))
{
context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object));
- g_signal_connect_swapped (context, "state-change", G_CALLBACK (refresh_all), sl);
+ if (context)
+ g_signal_connect_swapped (context, "state-change", G_CALLBACK (refresh_all), sl);
gtk_stack_page_set_visible (page, TRUE);
update_role (sl);
+ update_path (sl);
update_attributes (sl);
}
else
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/a11y.ui");
gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, box);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, role);
+ gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, path);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, attributes);
gtk_widget_class_bind_template_callback (widget_class, setup_cell_cb);
</child>
</object>
</child>
+ <child>
+ <object class="GtkBox">
+ <property name="margin-start">10</property>
+ <property name="margin-end">10</property>
+ <property name="margin-top">10</property>
+ <property name="margin-bottom">10</property>
+ <property name="spacing">40</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Object path</property>
+ <property name="halign">start</property>
+ <property name="valign">baseline</property>
+ <property name="xalign">0.0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="path">
+ <property name="selectable">1</property>
+ <property name="halign">end</property>
+ <property name="valign">baseline</property>
+ </object>
+ </child>
+ </object>
+ </child>
<child>
<object class="GtkSeparator"/>
</child>